package com.itheima.duotai2;

public class Test {
    public static void main(String[] args) {
        Sheep sheep = new Wolf();// 披着羊皮的狼
        System.out.println(sheep.mao);//成员变量看左边
        sheep.eat();//成员方法 看右边
//sheep.ao();
        /*sheep= new Sheep();
        System.out.println(sheep.mao);
        sheep.eat();*/
    }
}

class Sheep {
    String mao = "羊毛";
    public void eat() {
        System.out.println("羊吃草");
    }
}
class Wolf extends Sheep {
    String mao = "狼毫";
    @Override
    public void eat() {
        System.out.println("狼吃羊");
    }

    public void ao(){
        System.out.println("狼嚎");
    }
}